package com.jt.mapper;

import com.jt.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface UserMapper {
    List<User> findAll();
    @Select("select id,name,age,sex from demo_user where id =#{id}")
    User findUserById(int id);
    @Insert("insert into demo_user(id,name,age,sex)value(null,#{name},#{age},#{sex})")
    void insert(User user);
    @Update("update  demo_user set age=#{age},sex=#{sex} where name=#{name}")
    void updateByName(User user);

}
